<?php

namespace App\Models;


use App\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class UserTakeLog extends Model
{

    use HasFactory, HasDateTimeFormatter;

    protected $table = 'users_take_log';

    protected $casts = [
        'user_id' => 'integer',
        'loan_id' => 'integer',
        'price_ticket' => 'integer',
        'price_money' => 'float',
    ];

    protected $fillable = [
        'user_id', 'loan_id', 'price_ticket', 'price_money'
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function loan()
    {
        return $this->hasOne(LoanApplication::class, 'id', 'loan_id');
    }
}
